import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '主数据来源',
    align:"center",
    dataIndex: 'sysOriginal'
   },
   {
    title: '状态',
    align:"center",
    dataIndex: 'sysState'
   },
   {
    title: '金蝶编号',
    align:"center",
    dataIndex: 'kingdeeCode'
   },
   {
    title: '品牌',
    align:"center",
    dataIndex: 'brand'
   },
   {
    title: '产品名',
    align:"center",
    dataIndex: 'productName'
   },
   {
    title: '产品性质',
    align:"center",
    dataIndex: 'productNature'
   },
   {
    title: '产品类别',
    align:"center",
    dataIndex: 'productType'
   },
   {
    title: '产品系列',
    align:"center",
    dataIndex: 'productSeries'
   },
   {
    title: '单位',
    align:"center",
    dataIndex: 'unit'
   },
   {
    title: '产品型号',
    align:"center",
    dataIndex: 'productModel'
   },
   {
    title: '规格',
    align:"center",
    dataIndex: 'productSpecification'
   },
   {
    title: '外壳类型',
    align:"center",
    dataIndex: 'shelltype'
   },
   {
    title: '生产周期',
    align:"center",
    dataIndex: 'productCycle'
   },
   {
    title: '产品描述',
    align:"center",
    dataIndex: 'productDesc'
   },
   {
    title: '修改时间',
    align:"center",
    dataIndex: 'sysModifydata'
   },
   {
    title: '创建时间',
    align:"center",
    dataIndex: 'sysCreateTime'
   },
   {
    title: '条码',
    align:"center",
    dataIndex: 'barcode'
   },
   {
    title: '描述',
    align:"center",
    dataIndex: 'description'
   },
   {
    title: '物料分组',
    align:"center",
    dataIndex: 'materialgroupFname'
   },
   {
    title: '物料属性',
    align:"center",
    dataIndex: 'erpclsid'
   },
   {
    title: '数据状态',
    align:"center",
    dataIndex: 'documentstatus'
   },
   {
    title: '禁用状态',
    align:"center",
    dataIndex: 'forbidstatus'
   },
   {
    title: '基本单位.编码',
    align:"center",
    dataIndex: 'baseunitidNumber'
   },
   {
    title: '创建组织',
    align:"center",
    dataIndex: 'createorgidNumber'
   },
   {
    title: '使用组织',
    align:"center",
    dataIndex: 'useorgidNumber'
   },
   {
    title: '允许库存',
    align:"center",
    dataIndex: 'isinventory'
   },
   {
    title: '允许销售',
    align:"center",
    dataIndex: 'issale'
   },
   {
    title: '允许资产',
    align:"center",
    dataIndex: 'isasset'
   },
   {
    title: '允许委外',
    align:"center",
    dataIndex: 'issubcontract'
   },
   {
    title: '允许生产',
    align:"center",
    dataIndex: 'isproduce'
   },
   {
    title: '允许采购',
    align:"center",
    dataIndex: 'ispurchase'
   },
   {
    title: '仓库',
    align:"center",
    dataIndex: 'stockidNumber'
   },
   {
    title: '采购组织.编码',
    align:"center",
    dataIndex: 'purchaseorgidNumber'
   },
   {
    title: '启用批号管理',
    align:"center",
    dataIndex: 'isbatchmanage'
   },
   {
    title: '启用保质期管理',
    align:"center",
    dataIndex: 'iskfperiod'
   },
   {
    title: '启用序列号管理',
    align:"center",
    dataIndex: 'issnmanage'
   },
   {
    title: '安全库存',
    align:"center",
    dataIndex: 'safestock'
   },
   {
    title: '存货类别',
    align:"center",
    dataIndex: 'categoryid'
   },
   {
    title: '保质期',
    align:"center",
    dataIndex: 'expperiod'
   },
   {
    title: '起订量',
    align:"center",
    dataIndex: 'orderqty'
   },
   {
    title: '最小批量',
    align:"center",
    dataIndex: 'minqty'
   },
   {
    title: '最大批量',
    align:"center",
    dataIndex: 'maxqty'
   },
   {
    title: '默认供应商',
    align:"center",
    dataIndex: 'defaultvendorFnumber'
   },
   {
    title: '最大订货量',
    align:"center",
    dataIndex: 'maxpoqty'
   },
   {
    title: '最小订货量',
    align:"center",
    dataIndex: 'minpoqty'
   },
   {
    title: '最小包装量',
    align:"center",
    dataIndex: 'increaseqty'
   },
   {
    title: '固定提前期',
    align:"center",
    dataIndex: 'fixleadtime'
   },
   {
    title: '变动提前期',
    align:"center",
    dataIndex: 'varleadtime'
   },
   {
    title: '拆分批量',
    align:"center",
    dataIndex: 'planbatchsplitqty'
   },
   {
    title: '采购类型',
    align:"center",
    dataIndex: 'obilltypeidNumber'
   },
   {
    title: '保修期',
    align:"center",
    dataIndex: 'warranty'
   },
   {
    title: '零售价',
    align:"center",
    dataIndex: 'saleprice'
   },
   {
    title: '会员价',
    align:"center",
    dataIndex: 'vipprice'
   },
   {
    title: '采购单价',
    align:"center",
    dataIndex: 'purprice'
   },
  {
    title: '新字段',
    align:"center",
    dataIndex: 'newfield'
  },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
	{
      label: "金蝶编号",
      field: 'kingdeeCode',
      component: 'Input',
      //colProps: {span: 6},
 	},
	{
      label: "产品名",
      field: 'productName',
      component: 'Input',
      //colProps: {span: 6},
 	},
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '主数据来源',
    field: 'sysOriginal',
    component: 'Input',
  },
  {
    label: '状态',
    field: 'sysState',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入状态!'},
          ];
     },
  },
  {
    label: '金蝶编号',
    field: 'kingdeeCode',
    component: 'Input',
  },
  {
    label: '品牌',
    field: 'brand',
    component: 'Input',
  },
  {
    label: '产品名',
    field: 'productName',
    component: 'Input',
  },
  {
    label: '产品性质',
    field: 'productNature',
    component: 'Input',
  },
  {
    label: '产品类别',
    field: 'productType',
    component: 'Input',
  },
  {
    label: '产品系列',
    field: 'productSeries',
    component: 'Input',
  },
  {
    label: '单位',
    field: 'unit',
    component: 'Input',
  },
  {
    label: '产品型号',
    field: 'productModel',
    component: 'Input',
  },
  {
    label: '规格',
    field: 'productSpecification',
    component: 'Input',
  },
  {
    label: '外壳类型',
    field: 'shelltype',
    component: 'Input',
  },
  {
    label: '生产周期',
    field: 'productCycle',
    component: 'Input',
  },
  {
    label: '产品描述',
    field: 'productDesc',
    component: 'Input',
  },
  {
    label: '修改时间',
    field: 'sysModifydata',
    component: 'DatePicker',
    componentProps: {
       showTime: true,
       valueFormat: 'YYYY-MM-DD HH:mm:ss'
     },
  },
  {
    label: '创建时间',
    field: 'sysCreateTime',
    component: 'DatePicker',
    componentProps: {
       showTime: true,
       valueFormat: 'YYYY-MM-DD HH:mm:ss'
     },
  },
  {
    label: '条码',
    field: 'barcode',
    component: 'Input',
  },
  {
    label: '描述',
    field: 'description',
    component: 'Input',
  },
  {
    label: '物料分组',
    field: 'materialgroupFname',
    component: 'Input',
  },
  {
    label: '物料属性',
    field: 'erpclsid',
    component: 'Input',
  },
  {
    label: '数据状态',
    field: 'documentstatus',
    component: 'Input',
  },
  {
    label: '禁用状态',
    field: 'forbidstatus',
    component: 'Input',
  },
  {
    label: '基本单位.编码',
    field: 'baseunitidNumber',
    component: 'Input',
  },
  {
    label: '创建组织',
    field: 'createorgidNumber',
    component: 'Input',
  },
  {
    label: '使用组织',
    field: 'useorgidNumber',
    component: 'Input',
  },
  {
    label: '允许库存',
    field: 'isinventory',
    component: 'Input',
  },
  {
    label: '允许销售',
    field: 'issale',
    component: 'Input',
  },
  {
    label: '允许资产',
    field: 'isasset',
    component: 'Input',
  },
  {
    label: '允许委外',
    field: 'issubcontract',
    component: 'Input',
  },
  {
    label: '允许生产',
    field: 'isproduce',
    component: 'Input',
  },
  {
    label: '允许采购',
    field: 'ispurchase',
    component: 'Input',
  },
  {
    label: '仓库',
    field: 'stockidNumber',
    component: 'Input',
  },
  {
    label: '采购组织.编码',
    field: 'purchaseorgidNumber',
    component: 'Input',
  },
  {
    label: '启用批号管理',
    field: 'isbatchmanage',
    component: 'Input',
  },
  {
    label: '启用保质期管理',
    field: 'iskfperiod',
    component: 'Input',
  },
  {
    label: '启用序列号管理',
    field: 'issnmanage',
    component: 'Input',
  },
  {
    label: '安全库存',
    field: 'safestock',
    component: 'Input',
  },
  {
    label: '存货类别',
    field: 'categoryid',
    component: 'Input',
  },
  {
    label: '保质期',
    field: 'expperiod',
    component: 'Input',
  },
  {
    label: '起订量',
    field: 'orderqty',
    component: 'Input',
  },
  {
    label: '最小批量',
    field: 'minqty',
    component: 'Input',
  },
  {
    label: '最大批量',
    field: 'maxqty',
    component: 'Input',
  },
  {
    label: '默认供应商',
    field: 'defaultvendorFnumber',
    component: 'Input',
  },
  {
    label: '最大订货量',
    field: 'maxpoqty',
    component: 'Input',
  },
  {
    label: '最小订货量',
    field: 'minpoqty',
    component: 'Input',
  },
  {
    label: '最小包装量',
    field: 'increaseqty',
    component: 'Input',
  },
  {
    label: '固定提前期',
    field: 'fixleadtime',
    component: 'Input',
  },
  {
    label: '变动提前期',
    field: 'varleadtime',
    component: 'DatePicker',
    componentProps: {
       showTime: true,
       valueFormat: 'YYYY-MM-DD HH:mm:ss'
     },
  },
  {
    label: '拆分批量',
    field: 'planbatchsplitqty',
    component: 'DatePicker',
    componentProps: {
       showTime: true,
       valueFormat: 'YYYY-MM-DD HH:mm:ss'
     },
  },
  {
    label: '采购类型',
    field: 'obilltypeidNumber',
    component: 'Input',
  },
  {
    label: '保修期',
    field: 'warranty',
    component: 'Input',
  },
  {
    label: '零售价',
    field: 'saleprice',
    component: 'InputNumber',
  },
  {
    label: '会员价',
    field: 'vipprice',
    component: 'InputNumber',
  },
  {
    label: '采购单价',
    field: 'purprice',
    component: 'InputNumber',
  },
  {
    label: '新字段',
    field: 'newfield',
    component: 'InputNumber',
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];

// 高级查询数据
export const superQuerySchema = {
  sysOriginal: {title: '主数据来源',order: 0,view: 'text', type: 'string',},
  sysState: {title: '状态',order: 1,view: 'text', type: 'string',},
  kingdeeCode: {title: '金蝶编号',order: 2,view: 'text', type: 'string',},
  brand: {title: '品牌',order: 3,view: 'text', type: 'string',},
  productName: {title: '产品名',order: 4,view: 'text', type: 'string',},
  productNature: {title: '产品性质',order: 5,view: 'text', type: 'string',},
  productType: {title: '产品类别',order: 6,view: 'text', type: 'string',},
  productSeries: {title: '产品系列',order: 7,view: 'text', type: 'string',},
  unit: {title: '单位',order: 8,view: 'text', type: 'string',},
  productModel: {title: '产品型号',order: 9,view: 'text', type: 'string',},
  productSpecification: {title: '规格',order: 10,view: 'text', type: 'string',},
  shelltype: {title: '外壳类型',order: 11,view: 'text', type: 'string',},
  productCycle: {title: '生产周期',order: 12,view: 'text', type: 'string',},
  productDesc: {title: '产品描述',order: 13,view: 'text', type: 'string',},
  sysModifydata: {title: '修改时间',order: 14,view: 'datetime', type: 'string',},
  sysCreateTime: {title: '创建时间',order: 15,view: 'datetime', type: 'string',},
  barcode: {title: '条码',order: 16,view: 'text', type: 'string',},
  description: {title: '描述',order: 17,view: 'text', type: 'string',},
  materialgroupFname: {title: '物料分组',order: 18,view: 'text', type: 'string',},
  erpclsid: {title: '物料属性',order: 19,view: 'text', type: 'string',},
  documentstatus: {title: '数据状态',order: 20,view: 'text', type: 'string',},
  forbidstatus: {title: '禁用状态',order: 21,view: 'text', type: 'string',},
  baseunitidNumber: {title: '基本单位.编码',order: 22,view: 'text', type: 'string',},
  createorgidNumber: {title: '创建组织',order: 23,view: 'text', type: 'string',},
  useorgidNumber: {title: '使用组织',order: 24,view: 'text', type: 'string',},
  isinventory: {title: '允许库存',order: 25,view: 'text', type: 'string',},
  issale: {title: '允许销售',order: 26,view: 'text', type: 'string',},
  isasset: {title: '允许资产',order: 27,view: 'text', type: 'string',},
  issubcontract: {title: '允许委外',order: 28,view: 'text', type: 'string',},
  isproduce: {title: '允许生产',order: 29,view: 'text', type: 'string',},
  ispurchase: {title: '允许采购',order: 30,view: 'text', type: 'string',},
  stockidNumber: {title: '仓库',order: 31,view: 'text', type: 'string',},
  purchaseorgidNumber: {title: '采购组织.编码',order: 32,view: 'text', type: 'string',},
  isbatchmanage: {title: '启用批号管理',order: 33,view: 'text', type: 'string',},
  iskfperiod: {title: '启用保质期管理',order: 34,view: 'text', type: 'string',},
  issnmanage: {title: '启用序列号管理',order: 35,view: 'text', type: 'string',},
  safestock: {title: '安全库存',order: 36,view: 'text', type: 'string',},
  categoryid: {title: '存货类别',order: 37,view: 'text', type: 'string',},
  expperiod: {title: '保质期',order: 38,view: 'text', type: 'string',},
  orderqty: {title: '起订量',order: 39,view: 'text', type: 'string',},
  minqty: {title: '最小批量',order: 40,view: 'text', type: 'string',},
  maxqty: {title: '最大批量',order: 41,view: 'text', type: 'string',},
  defaultvendorFnumber: {title: '默认供应商',order: 42,view: 'text', type: 'string',},
  maxpoqty: {title: '最大订货量',order: 43,view: 'text', type: 'string',},
  minpoqty: {title: '最小订货量',order: 44,view: 'text', type: 'string',},
  increaseqty: {title: '最小包装量',order: 45,view: 'text', type: 'string',},
  fixleadtime: {title: '固定提前期',order: 46,view: 'text', type: 'string',},
  varleadtime: {title: '变动提前期',order: 47,view: 'datetime', type: 'string',},
  planbatchsplitqty: {title: '拆分批量',order: 48,view: 'datetime', type: 'string',},
  obilltypeidNumber: {title: '采购类型',order: 49,view: 'text', type: 'string',},
  warranty: {title: '保修期',order: 50,view: 'text', type: 'string',},
  saleprice: {title: '零售价',order: 51,view: 'number', type: 'number',},
  vipprice: {title: '会员价',order: 52,view: 'number', type: 'number',},
  purprice: {title: '采购单价',order: 53,view: 'number', type: 'number',},
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
